﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using EZCRS.HCMS.SqlClient;
using EZCRS.HCMS.Entity;

namespace EZCRS.HCMS.Bll.baseinfo
{
    public class BllHotelUtil
    {
        #region 日志列表
        public DataSet Log_List()
        {
            return new sql_AdmLog().Log_List();
        }
        #endregion

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet Log_List(int PageSize, int PageIndex, string StrWhere)
        {
            return new sql_AdmLog().Log_List(PageSize, PageIndex, StrWhere);
        }

        ///<summary>
        ///分页获取数据总数
        ///</summary>
        public int Getrecordcount(string strWhere)
        {
            return new sql_AdmLog().Getrecordcount(strWhere);
        }

        ///////////////////////////////////
        /// <summary>
        /// 集团列表
        /// </summary>
        /// <returns></returns>
        public DataTable Group_List(string GroupList)
        {
            return new sql_AdmGroup().Group_List(GroupList);
        }
        public DataTable Group_List(int parentid)
        {
            return new sql_AdmGroup().Group_List(parentid);
        }

        public List<dropdowndata> Group_list()
        {
            return new sql_AdmGroup().Group_list();
        }

        



        /// <summary>
        /// 添加或修改集团信息
        /// </summary>
        /// <param name="GId">集团编号；重复为修改，否则新增</param>
        /// <param name="GIdE">英文编号</param>
        /// <param name="GrpName">集团名称</param>
        /// <param name="GrpDomain">集团域名</param>
        /// <param name="InUser">录入人</param>
        /// <param name="InDate">录入时间</param>
        /// <param name="Msg">修改或新增</param>
        /// <returns></returns>
        public bool Group_Add(string GId, string GIdE, string GrpName, string GrpDomain, string InUser, out string Msg)
        {
            GId=CFun.VerifySQL(GId);
            GIdE=CFun.VerifySQL(GIdE);
            return new sql_AdmGroup().Group_Add(GId,GIdE,GrpName,GrpDomain,InUser,out Msg);
        }

        /// <summary>
        /// 删除集团
        /// </summary>
        /// <param name="GId">集团编号</param>
        /// <returns></returns>
        public bool Group_Del(string GId)
        {
            GId=CFun.VerifySQL(GId);
            return new sql_AdmGroup().Group_Del(GId);
        }


        /// <summary>
        /// 返回一条集团信息
        /// </summary>
        /// <param name="GId">集团编号</param>
        /// <returns></returns>
        public DataRow Group_Item(string GId)
        {
            GId=CFun.VerifySQL(GId);
            return new sql_AdmGroup().Group_Item(GId);
        }


        public bool Group_Add(string gclass, string gname, string gnameen, string greadme, string gcity, string gshowtop, string gcss, string gid)
        {
            return new sql_AdmGroup().Group_Add(gclass,gname,gnameen,greadme,gcity,gshowtop,gcss,gid);
        }

        /// <summary>
        /// 保存排序设定
        /// </summary>
        /// <param name="classidlist"></param>
        /// <returns></returns>
        public bool Group_SaveSort(string classidlist)
        {
            return new sql_AdmGroup().Group_SaveSort(classidlist);
        }

        ////////////////////////////////////////////////////////////
        string SqlStr = "";
        #region 酒店的删除
        /// <summary>
        /// 酒店的删除
        /// </summary>
        /// <param name="Htlid"></param>
        /// <returns></returns>
        public bool Hotel_Del(string pidlist)
        {
            pidlist=CFun.getidlist(pidlist);
            return new sql_AdmHotel().Hotel_Del(pidlist);
        }
        #endregion

        #region 加入集团或从集团中移除
        /// <summary>
        /// 加入集团
        /// </summary>
        /// <param name="pidlist"></param>
        /// <param name="gid"></param>
        /// <returns></returns>
        public bool addintogroup(string pidlist, string gid)
        {
            pidlist=CFun.getidlist(pidlist);
            return new sql_AdmHotel().addintogroup(pidlist,gid);
        }
        /// <summary>
        /// 从集团中移除
        /// </summary>
        /// <param name="pidlist"></param>
        /// <param name="gid"></param>
        /// <returns></returns>
        public bool removefromgroup(string pidlist, string gid)
        {
            pidlist=CFun.getidlist(pidlist);
            return new sql_AdmHotel().removefromgroup(pidlist,gid);;
        }
        #endregion

        #region 酒店Info数据的显示,显示一条数据
        /// <summary>
        /// 酒店Info数据的显示,显示一条数据
        /// </summary>
        /// <param name="HtlId"></param>
        /// <returns></returns>
        public DataRow Hotel_Item(string HtlId)
        {
            return new sql_AdmHotel().Hotel_Item(HtlId);

        }
        #endregion

        public bool AddHotel(string Pid, string gid, string htldomain, string inuser, string Htlid)
        {
            Htlid=CFun.VerifySQL(Htlid);
            return new sql_AdmHotel().AddHotel(Pid,gid,htldomain,inuser,Htlid);
        }

        /// <summary>
        /// 返回酒店名称和pid
        /// </summary>
        /// <param name="PIdList">酒店列表；逗号分割的酒店编号</param>
        /// <returns></returns>
        public DataTable HotelName_List(string PIdList)
        {
            PIdList=CFun.VerifySQL(PIdList);
            return new sql_AdmHotel().HotelName_List(PIdList);
        }

        /// <summary>
        /// 返回酒店名和pid
        /// </summary>
        /// <param name="GroupId">集团id 没有为空</param>
        /// <param name="RType">类型 1=所有酒店 2=集团酒店 3=所有非集团酒店</param>
        /// <returns></returns>
        public DataTable HotelName_List(string GroupId, int RType)
        {
            GroupId=CFun.VerifySQL(GroupId);
            return new sql_AdmHotel().HotelName_List(GroupId,RType);

        }
        #region 酒店列表
        public DataTable Hotel_List(string StrWhere)
        {
            return new sql_AdmHotel().Hotel_List(StrWhere);
        }

        public DataSet Hotel_List(int cpage, string hotelname, string hoteladdress, string pid, string groupid)
        {
            return new sql_AdmHotel().Hotel_List(cpage,hotelname,hoteladdress,pid,groupid);
        }

        public DataSet Hotel_List(int cpage, string hotelname, string hoteladdress, string pid)
        {
            return new sql_AdmHotel().Hotel_List(cpage,hotelname,hoteladdress,pid);
        }
        #endregion
        /// <summary>
        /// 返回酒店名称和pid
        /// </summary>
        /// <param name="PIdList">酒店列表；逗号分割的酒店编号</param>
        /// <returns></returns>
        public DataTable Hotel_Title_List(string Title)
        {
            Title=CFun.VerifySQL(Title);
            return new sql_AdmHotel().Hotel_Title_List(Title);
        }
        public DataTable Hotel_Title_List(int pid)
        {
            return new sql_AdmHotel().Hotel_Title_List(pid);
        }

        #region 酒店照片

        /// <summary>
        /// 根据酒店ID获取照片 Jay
        /// </summary>
        /// <param name="HotelCode">酒店ID</param>
        /// <returns></returns>
        public DataTable GetHotelPhoto(int HotelCode)
        {
            return new sql_AdmHotel().GetHotelPhoto(HotelCode);
        }

        /// <summary>
        /// 根据照片ID获取照片
        /// </summary>
        /// <param name="PhotoID">照片ID</param>
        /// <returns></returns>
        public DataTable GetHotelPhotoByID(int PhotoID)
        {
            return new sql_AdmHotel().GetHotelPhotoByID(PhotoID);
        }

        /// <summary>
        /// 添加照片
        /// </summary>
        /// <param name="HotelCode">酒店ID</param>
        /// <param name="PhotoName">照片名称</param>
        /// <param name="Url">照片路径</param>
        /// <param name="PhotoType">照片类型</param>
        /// <param name="ID">返回最新ID</param>
        /// <returns></returns>
        public bool AddPhoto(int HotelCode, string PhotoName, string Url, int PhotoType, out int ID)
        {

            return new sql_AdmHotel().AddPhoto(HotelCode,PhotoName,Url,PhotoType,out ID);
        }

        /// <summary>
        /// 更新照片
        /// </summary>
        /// <param name="PhotoID">照片ID</param>
        /// <param name="PhotoName">照片名称</param>
        /// <param name="Url">URL</param>
        /// <param name="PhotoType">照片类型</param>
        /// <returns></returns>
        public bool UpdatePhoto(int PhotoID, string PhotoName, string Url, int PhotoType)
        {
            return new sql_AdmHotel().UpdatePhoto(PhotoID,PhotoName,Url,PhotoType);

        }


        /// <summary>
        /// 更新照片信息
        /// </summary>
        /// <param name="PhotoID">照片ID</param>
        /// <param name="PhotoName">照片名称</param>
        /// <param name="PhotoType">照片类型</param>
        /// <returns></returns>
        public bool UpdatePhoto(int PhotoID, string PhotoName, int PhotoType)
        {
            return new sql_AdmHotel().UpdatePhoto(PhotoID,PhotoName,PhotoType);

        }

        /// <summary>
        /// 删除照片记录
        /// </summary>
        /// <param name="PhotoID"></param>
        /// <returns></returns>
        public bool DeletePhoto(int PhotoID)
        {
            return new sql_AdmHotel().DeletePhoto(PhotoID);

        }

        #endregion

        #region 酒店价格代码

        /// <summary>
        /// 获取酒店价格代码
        /// </summary>
        /// <param name="Pid">酒店ID</param>
        /// <param name="State">激活</param>
        /// <param name="Page">页码</param>
        /// <returns></returns>
        public DataSet GetHotelRateList(int Pid, int State, int Page)
        {
            return new sql_AdmHotel().GetHotelRateList(Pid,State,Page);
        }

        public DataSet GetHotelRateList(int Pid, int State, int Page, int PageSize)
        {
            return new sql_AdmHotel().GetHotelRateList(Pid,State,Page,PageSize);
        }

        #endregion
    }
}
